import { z } from "zod";

export const R_CONTENT = {
  MIN_LENGTH: 1,
  MAX_LENGTH: 10000,
};

export const R_TITLE = {
  MIN_LENGTH: 1,
  MAX_LENGTH: 200,
};

// prettier-ignore
export const CONTENT_ZOD = z.string()
    .min(R_CONTENT.MIN_LENGTH, {message: `Content must be at least ${R_CONTENT.MIN_LENGTH} characters.` })
    .max(R_CONTENT.MAX_LENGTH, {message: `Content must be at most ${R_CONTENT.MAX_LENGTH} characters.` })

// prettier-ignore
export const TITLE_ZOD = z.string()
    .min(R_TITLE.MIN_LENGTH, {message: `Title must be at least ${R_TITLE.MIN_LENGTH} characters.` })
    .max(R_TITLE.MAX_LENGTH, {message: `Title must be at most ${R_TITLE.MAX_LENGTH} characters.` })

export const CONTENT_TYPE_ZOD = z.enum(["md"], {
  required_error: "Content type is required.",
  invalid_type_error: "Content type is invalid.",
});

export const PERSONAL_ZOD = z.boolean({
  required_error: "Personal is required.",
  invalid_type_error: "Personal is invalid.",
});
